{
  "$schema" : "http://json-schema.org/draft/2019-09/schema#",
  "title" : "Receipt Print Response",
  "type" : "object",
  "additionalProperties" : false,
  "properties" : {
    "identifier" : {
      "type" : "integer",
      "description" : "Unique identifier for each file that is produced or processed by CMP"
    },
    "interfaceCategory" : {
      "type" : "string",
      "enum" : [ "Billing" ],
      "description" : "CMP categorisation of the job associated with this file "
    },
    "interfaceType" : {
      "type" : "string",
      "enum" : [ "Receipt Print" ],
      "description" : "Sub-categorisation of the job"
    },
    "version" : {
      "type" : "number",
      "minimum" : 0.0,
      "maximum" : 99.99,
      "description" : "The current version of the generic extract file. This must match the corresponding inbound file."
    },
    "batchDateTime" : {
      "type" : "string",
      "format" : "date-time",
      "description" : "Represents when a batch was created in CMP"
    },
    "extractDateTime" : {
      "type" : "string",
      "format" : "date-time",
      "description" : "Represents when a generic CMP file was created from a batch"
    },
    "recordCount" : {
      "type" : "integer",
      "description" : "Number of records within the original batch"
    },
    "companyName" : {
      "type" : "string",
      "maxLength" : 30,
      "description" : "Actual name of a company"
    },
    "addressLines" : {
      "type" : "array",
      "minItems" : 0,
      "maxItems" : 5,
      "items" : {
        "$ref" : "#/definitions/AddressLine"
      },
      "description" : "Address Line Information"
    },
    "companyRegisteredNumber" : {
      "type" : "string",
      "maxLength" : 25,
      "description" : "This is the company registration number for VAT purposes"
    },
    "postCode" : {
      "type" : "string",
      "maxLength" : 10,
      "description" : "Post Code of a company"
    },
    "envelopes" : {
      "type" : "array",
      "items" : {
        "$ref" : "#/definitions/ReceiptPrintResponseEnvelope"
      },
      "description" : "All batches consists of one or more details which represent distinct billing addresses"
    }
  },
  "required" : [ "batchDateTime", "extractDateTime" ],
  "definitions" : {
    "AddressLine" : {
      "type" : "object",
      "additionalProperties" : false,
      "properties" : {
        "line" : {
          "type" : "string",
          "maxLength" : 60,
          "description" : "Address of a particular subscription. Address line 1 is mandatory, rest are optional"
        }
      }
    },
    "ReceiptPrintResponseEnvelope" : {
      "type" : "object",
      "additionalProperties" : false,
      "properties" : {
        "billingMedia" : {
          "$ref" : "#/definitions/BillingMedia",
          "description" : "Billing media information"
        },
        "emailAddress" : {
          "type" : "string",
          "maxLength" : 70,
          "description" : "Email address of the subscription or account that is to receive the invoice/statement/detailed bill"
        },
        "postalAddress" : {
          "$ref" : "#/definitions/PostalAddress",
          "description" : "Postal address information"
        },
        "companyName" : {
          "type" : "string",
          "maxLength" : 20,
          "description" : "Name of a company"
        },
        "companyRegisteredNumber" : {
          "type" : "string",
          "maxLength" : 25,
          "description" : "This is the company registration number for VAT purposes"
        },
        "idType" : {
          "type" : "string",
          "maxLength" : 10,
          "description" : "Personal taxation reference id type"
        },
        "idTypeDescription" : {
          "type" : "string",
          "maxLength" : 30,
          "description" : "Personal taxation reference id type description"
        },
        "idNumber" : {
          "type" : "string",
          "maxLength" : 30,
          "description" : "This is the id number for personal taxation reference"
        },
        "receipts" : {
          "type" : "array",
          "items" : {
            "$ref" : "#/definitions/ReceiptsAccount"
          },
          "description" : "This is the receipts are represent in same account"
        }
      }
    },
    "BillingMedia" : {
      "type" : "object",
      "additionalProperties" : false,
      "properties" : {
        "id" : {
          "type" : "string",
          "maxLength" : 6,
          "description" : "Unique identifier for a billing media code. Indicates a subscription preferred method of receiving their invoice.  Subscription can opt to receive standard format, large font format, audio, braille or email"
        },
        "description" : {
          "type" : "string",
          "maxLength" : 30,
          "description" : "Actual name of the billing media"
        }
      }
    },
    "PostalAddress" : {
      "type" : "object",
      "additionalProperties" : false,
      "properties" : {
        "title" : {
          "type" : "string",
          "maxLength" : 15,
          "description" : "Title by which a subscription wishes to be referred to as"
        },
        "foreName" : {
          "type" : "string",
          "maxLength" : 50,
          "description" : "First name of a subscription"
        },
        "middleName" : {
          "type" : "string",
          "maxLength" : 20,
          "description" : "Middle name of a subscription"
        },
        "surname" : {
          "type" : "string",
          "maxLength" : 50,
          "description" : "Surname of a subscription"
        },
        "postCode" : {
          "type" : "string",
          "maxLength" : 10,
          "description" : "Post Code of a subscription"
        },
        "addressLines" : {
          "type" : "array",
          "minItems" : 0,
          "maxItems" : 5,
          "items" : {
            "$ref" : "#/definitions/AddressLine"
          },
          "description" : "Address Line Information"
        }
      }
    },
    "ReceiptsAccount" : {
      "type" : "object",
      "additionalProperties" : false,
      "properties" : {
        "receiptType" : {
          "$ref" : "#/definitions/BondDetails",
          "description" : "Bond details"
        },
        "purchase" : {
          "$ref" : "#/definitions/Purchase",
          "description" : "Purchase information array"
        },
        "account" : {
          "type" : "integer",
          "description" : "This represents the cmp account a purchase is linked to"
        },
        "price" : {
          "type" : "number",
          "description" : "This represents the tax inclusive price of the purchase"
        },
        "salesperson" : {
          "type" : "integer",
          "description" : "This represents the sales person through whom the purchase was made"
        },
        "salesChannel" : {
          "type" : "string",
          "description" : "This represents the sales channel through which the purchase was made"
        },
        "paymentIdentifier" : {
          "type" : "integer",
          "description" : "This represents an unique identifier for the payment that is associated with the purchase."
        },
        "paymentDateTime" : {
          "type" : "string",
          "format" : "date-time",
          "description" : "This represents the date and time the payment was made for the purchased item"
        }
      }
    },
    "BondDetails" : {
      "type" : "object",
      "additionalProperties" : false,
      "properties" : {
        "purchaseId" : {
          "type" : "integer",
          "description" : "This represents a unique identifier for a given purchase"
        },
        "bondIdentifier" : {
          "type" : "integer",
          "description" : "Bond Identifier"
        }
      }
    },
    "Purchase" : {
      "type" : "object",
      "additionalProperties" : false,
      "properties" : {
        "purchaseTimestamp" : {
          "type" : "string",
          "format" : "date-time",
          "description" : "This represents the date time a purchase was made"
        },
        "customerLevel" : {
          "type" : "string",
          "description" : "Customer lavel"
        },
        "customerReference" : {
          "type" : "string",
          "description" : "Customer reference"
        },
        "productType" : {
          "type" : "string",
          "description" : "Product type"
        },
        "product" : {
          "$ref" : "#/definitions/Product",
          "description" : "Product details"
        }
      },
      "required" : [ "customerLevel", "customerReference", "productType", "product" ]
    },
    "Product" : {
      "type" : "object",
      "additionalProperties" : false,
      "properties" : {
        "productCode" : {
          "type" : "string",
          "description" : "Product Code"
        },
        "productDescription" : {
          "type" : "string",
          "description" : "Product Description"
        }
      },
      "required" : [ "productCode", "productDescription" ]
    }
  }
}